home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_cyn_whipfloor.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  334 lines

  1. # Jones 3D Cog Script
  2. #
  3. # CYN_whipfloor.cog
  4. #
  5. # minor cutscene cog for ruins in the canyonlands
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.     message        startup
  15.     message        damaged
  16.     message        entered
  17.  
  18.     #    cogs
  19.     cog            hintcog
  20.  
  21.     #    actors
  22.     thing        player                                local
  23.     thing        indyActor                            
  24.  
  25.     #    camera objects
  26.     thing        roomCam                                nolink
  27.     thing        caveCam                                nolink
  28.     thing        whipCam                                nolink
  29.  
  30.     #    props
  31.     thing        whipobject
  32.     thing        roofplatform
  33.     thing        floorplatform                        mask=0x80
  34.     thing        hiddenrock                            nolink
  35.     thing        fallenstrut                            nolink
  36.  
  37.     #    debris objects
  38.     thing        fragment1                            local
  39.     thing        fragment2                            local
  40.  
  41.  
  42.     #    break wall surfaces
  43.     surface        fragface0                            nolink
  44.     surface        fragface1                            nolink
  45.     surface        fragface2                            nolink
  46.  
  47.     #    control variables
  48.     int            sceneplay=0                            local
  49.     int            axis                                local
  50.     int            curCam                                local
  51.     int            falltrack                            local
  52.  
  53.     keyframe    in_brushoff=0in_cleanspants_1_1.key    local
  54.  
  55.     #    sounds
  56.     sound        rumblesound=tem_tikikey_place_c.wav    local
  57.     sound        in_whoa=INXJ007a.WAV                local
  58.     sound        in_oof=inxj018a.wav                    local
  59.     sound        quake=olv_fallfloor_c.wav            local
  60.     sound        quake2=sol_block_crash_c.wav        local
  61.     sound        in_scream=INXJ015.WAV                local
  62.  
  63.     #    DEBRIS EFFECTS FOR STRUT COLLAPSE
  64.     sound        sndFalling=gen_fallingrock_c.wav    local
  65. #    sound        rocksmash=shs_beam_c.wav            local
  66.     sound        thud=fol_bodyfall_buckle.wav        local
  67.     sound        whip_cue=mus_gen_indywhip1.wav        local
  68.     sound        eerie_cue=mus_gen_eerie1.wav        local
  69.  
  70.     template    debrisTpl=stnshrapa_nc_ns            local
  71.  
  72.     int            numDebris=2                            local
  73.     int            index                                local
  74.     int            i_playerCT                            local
  75.  
  76.     thing        rocks                                local
  77.     thing        origin                                local
  78.     sector        tempSect                            local
  79.  
  80.     #    Keyframes
  81.     keyframe    in_falling=in_jump_fall.key            local //159x
  82.  
  83.     #    Subroutines
  84.     flex        rockVelocity                        local
  85.     flex        fragVelocity                        local
  86.  
  87. end
  88.  
  89. # ========================================================================================
  90. code
  91.  
  92. startup:
  93.  
  94.     player = GetLocalPlayerThing();
  95.  
  96.     Sleep(0.3);
  97.  
  98.     for (index = 0; index <= 2; index = index + 1)
  99.     {
  100.         ClearAdjoinFlags(fragface0[index], 2);
  101.         ClearAdjoinFlags(GetSurfaceAdjoin(fragface0[index]), 2);
  102.         SetFaceGeoMode(fragface0[index], 4);
  103.     }
  104.  
  105.     SetThingFlags(hiddenrock, 0x80000);
  106.     SetThingFlags(fallenstrut, 0x80000);
  107.     
  108.     origin = GetThingPos(whipobject);
  109.     tempSect = GetThingSector(whipobject);
  110.     
  111.     return;
  112.  
  113. #========================================================
  114. damaged:
  115.  
  116.     if (sceneplay == 1) return;
  117.  
  118.     if ((GetSenderRef() == whipobject) && (GetParam(1) == 0x10))
  119.     {
  120.         sceneplay = 1;
  121.  
  122.         # solve hint
  123.         SendMessage(hintcog, user0);
  124.  
  125.         # Prep...
  126.         StartCutScene(1);
  127.         curCam = GetCurrentCamera();
  128.         SetCameraPosInterp(2, 0); # kill dolly
  129.         SetCameraLookInterp(2, 0); # kill pan & tilt
  130.  
  131.         # Cut to Indy as he swings...
  132.         SetCameraFocus(2, whipCam);
  133.         SetCameraSecondaryFocus(2, player);
  134.         SetCurrentCamera(2);
  135.         SetCameraFOV(80, 0, 0.0);
  136.         Sleep(0.01);
  137.         SetCameraFOV(70, 1, 4.0);
  138.         Sleep(2.0);
  139.  
  140.         # indy theme plays
  141.         PlaySoundLocal(whip_cue, 1.0, 0.0, 0x0, 0);
  142.         Sleep(0.5);
  143.  
  144.         # sound and object creation for collapsing whip strut
  145.         PlaySoundLocal(sndFalling, 1.0, 0.0, 0x0, 0);
  146.  
  147.         for(index = 0; index < numDebris; index = index + 1)
  148.         {
  149.             rocks = CreateThingAtPos(debrisTpl, tempSect, VectorAdd(origin, '0 0 0'), '0 0 0');
  150.             call rockVelocity;
  151.             Sleep(0.1);
  152.         }
  153.  
  154.         Sleep(0.5);
  155.         # sound for whipstrut hitting the ground
  156.         PlaySoundLocal(thud, 1.0, 1.0, 0x0, 0);
  157.     }
  158.  
  159.     return;
  160.  
  161. #========================================================
  162. entered:
  163.  
  164.     if (GetSenderRef() == roofplatform)
  165.     {
  166.         # take away player control
  167.         StopThing(player);
  168.         DeselectWeapon(player);
  169.  
  170.         # move cam closer to Indy
  171.         MoveToFrame(whipCam, 1, 3);
  172.         # deal with cleaning the animations up
  173.         # shake the floor tile briefly
  174.         rumblesound = PlaySoundLocal(quake, 0.5, 0, 0x01, 0);
  175.         
  176.         # get the actor to the position of the player
  177.         CopyOrientAndPos(player, indyActor);
  178.         #CopyPlayerHolsters(player, indyActor);
  179.         
  180. #        SetThingFlags(player, 0x80000);
  181.         i_playerCT=GetCollideType(player);
  182.         SetThingFlags(player, 0x10);
  183.         SetCollideType(player, 0);
  184.  
  185.         ClearThingFlags(indyActor, 0x80000);
  186.         AISetCutsceneMode(indyActor);
  187.         
  188.         
  189.         # switch to room cam
  190.         SetCameraFocus(2, roomCam);
  191.         SetCameraSecondaryFocus(2, indyActor);
  192.         #Sleep(0.01);
  193.         #SetCameraFOV(70, 0, 0);
  194.         
  195.         
  196.         for (index = 0; index <= 6; index = index + 1) 
  197.         {
  198.             #DebugFlex(1, "loop start");
  199.             axis = RandBetween(0, 1);
  200.             #SetPOVShake('0.0 0.0 0.005', '0.0 0.0 0.0', 80.0, 0.80);
  201.             Rotate(roofplatform, 6, axis, .025);
  202.             Sleep(0.025);
  203.             Rotate(roofplatform, -6, axis, .025);
  204.             Sleep(0.025);
  205.         }
  206.  
  207.         # animate actor fall
  208.         falltrack = PlayKey(indyActor, in_falling, 2, 0x12, 0);
  209.         
  210.         # destroy the tile, indy falls through
  211.         StopSound(rumblesound, 0.5);
  212.         
  213.         fragment1 = CreateThing(debrisTpl, roofplatform);
  214.         fragment2 = CreateThing(debrisTpl, roofplatform);
  215.         call fragVelocity;
  216.  
  217.         DestroyThing(roofplatform);
  218.         PlaySoundLocal(quake2, 0.75, 0.0, 0x0, 0);
  219.     
  220. # inside section
  221.     
  222.         Sleep(1.0);
  223.         StopKey(indyActor, falltrack, 0);
  224.         # play eerie cue
  225.         PlaySoundLocal(eerie_cue, 1.0, 0.0, 0x0, 0);
  226.         # indy hits the ground, says "oof"
  227.         PlayVoice(indyActor, in_oof, 2, 1);
  228.         
  229.         
  230.         
  231.         # indy hits the ground, looks at the treasure, says "whoa"
  232.         AIEnableHeadTracking(indyActor, roomCam);
  233.         SetThingMaxRotVel(indyActor, 100.0);
  234.         Sleep(0.1);
  235.         AISetLookThing(indyActor, roomCam); 
  236.         AIDisableHeadTracking(indyActor);
  237.  
  238.         #PlayKey(player, in_brushoff, 4, 0x12, 0);
  239.         MoveToFrame(roomCam, 1, 4);
  240.         ResetCameraFOV(1, 2.0);
  241.         Sleep(.3);
  242.         PlayVoice(indyActor, in_whoa, 1, 0);
  243.         Sleep(0.5);
  244.  
  245.         # floortile collapses
  246.         rumblesound = PlaySoundLocal(quake, .5, 0, 0x01, 0);
  247.         for (index = 0 ; index <= 4; index = index + 1) 
  248.         {
  249.             #DebugFlex(1, "loop start");
  250.             axis = RandBetween(0, 1);
  251.             #SetPOVShake('0.0 0.0 0.005', '0.0 0.0 0.0', 80.0, 0.80);
  252.             Rotate(floorplatform, 3, axis, .05);
  253.             Sleep(0.05);
  254.             Rotate(floorplatform, -6, axis, .05);
  255.             Sleep(0.05);
  256.         }
  257.  
  258.         
  259.         # get the player to the position of the actor 
  260.         SetThingFlags(indyActor, 0x80000);
  261.         
  262. #        ClearThingFlags(player, 0x80000);
  263.         ClearThingFlags(player, 0x10);
  264.         SetCollideType(player, i_playerCT);
  265.         CopyOrientAndPos(indyActor, player);
  266.  
  267.         # stop sounds, destroy the floor tile
  268.         StopSound(rumblesound, 0.5);
  269.  
  270.         fragment1 = CreateThing(debrisTpl, floorplatform);
  271.         fragment2 = CreateThing(debrisTpl, floorplatform);
  272.         call fragVelocity;
  273.  
  274.         DestroyThing(floorplatform);
  275.         Sleep(0.25);
  276.  
  277.         # switch to cavecam
  278.         SetCameraFocus(2, caveCam);
  279.         SetCameraSecondaryFocus(2, player);
  280.         SetCameraFOV(90, 0, 0.0);
  281.  
  282.         Sleep(2.5);
  283.  
  284.  
  285.         # restore the camera
  286.         SetCameraPosition(1, GetThingPos(caveCam));
  287.         SetCurrentCamera(1);
  288.         RestoreExtCam();
  289.  
  290.         # player gains control and hits the water
  291.         EndCutScene();
  292.         ClearActorFlags(player, 0x200000);
  293.  
  294.         for (index = 0; index <= 2; index = index + 1)
  295.         {
  296.             SetAdjoinFlags(fragface0[index], 2);
  297.             SetAdjoinFlags(GetSurfaceAdjoin(fragface0[index]), 2);
  298.             SetFaceGeoMode(fragface0[index], 0);
  299.         }
  300.  
  301.         ClearThingFlags(hiddenrock, 0x80000);
  302.         
  303.         ClearThingFlags(fallenstrut, 0x80000);
  304.         SetCollideType(fallenstrut, 0);
  305.         SetThingFlags(whipobject, 0x80000);
  306.         #MoveToFrame(whipobject, 1, 10);
  307.     
  308.     }
  309. return;
  310.  
  311. #========================================================
  312. rockVelocity:
  313.  
  314.     SetThingVel(rocks, VectorScale('0.0 0.0 0.01', 0.7));
  315.     SetThingRotVel(rocks, '0.0 0.0 360.0');
  316.     return;
  317.  
  318. #========================================================
  319. fragVelocity:
  320.  
  321.     SetThingMass(fragment1, 1);
  322.     SetThingMass(fragment2, 1);
  323.     #SetCollideType(fragment1, 0);
  324.     #SetCollideType(fragment2, 0);
  325.     SetThingVel(fragment1, VectorSet(RandBetween(0, 4) * 0.1, RandBetween(0, 2) * 0.1, -0.5));
  326.     SetThingVel(fragment2, VectorSet(RandBetween(0, 4) * 0.1, RandBetween(0, 2) * 0.1, -0.5));
  327.     SetThingRotVel(fragment1, VectorScale(RandVec(), 100.0));
  328.     SetThingRotVel(fragment2, VectorScale(RandVec(), 100.0));
  329.     return;
  330.  
  331. #========================================================
  332. #========================================================
  333. end
  334.